﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sabloane_de_proiectare.Memento
{
    public class MementoStates
    {
        public State states { get; set; }
        public MementoStates()
        {
            states = new State();
        }
        public void saveState(GridElements source)
        {
            if (states.source.Count < 5)
            {
                states.saveState(source);
            }
            else
            {
                states.source.RemoveAt(0) ;
                states.source.Insert(0,source);
            }
            
        }
        public GridElements loadState()
        {
            if (states.source.Count < 5)
            {
                return states.loadState(states.source.Count);
            }
            else
            {
                return states.loadState(0);
            }
        }
 
    }
}
